perm filename IMPJOE[SS,SYS] blob sn#711692 filedate 1983-05-26 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00005 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	TITLE ITEST  IMP
C00003 00003	Cono/Coni bits  test strin i32 o32 clrst clrwt strout fino iepien idpien odpien test imperr idone iend odone
C00005 00004	 mpln p patch NGOOD GOOD LGOOD START spw spwdsp zwait zdsp nzwait ndsp fwait fdsp bwait dsmg bdsp cpopj1 count dsm spwst owd owd1 owd2 owd4 blklup owdlup cno1 owd3 ilp inpsom inptst chklup inpc ublki LOSE
C00012 00005	 illans rdlf main tml tlp setst notst notch outs outl seti36 seti32 noich ons onl seto36 seto32 nooch
C00016 ENDMK
C⊗;
TITLE ITEST ;⊗ IMP

IMP←←400
;Cono/Coni bits ;⊗ test strin i32 o32 clrst clrwt strout fino iepien idpien odpien test imperr idone iend odone

; Cono Bits . . .

test←←100000		; Enter test mode (does anal-cranial inversion)
strin←←040000		; Start input, sets stop, clears input end
i32←←020000		; Set input byte size to 32b if IDPIEN set
o32←←010000		; Set output byte size to 32b if ODPIEN set
clrst←←004000		; Clear stop after input bit
clrwt←←002000		; Clear waiting to input bit
strout←←000200		; Start output
fino←←000100		; Finish output (last bit has been sent)
iepien←←000040		; Enable change of input end interrupt channel
idpien←←000020		; Enable change of input byte size and input done interrupt channel
odpien←←000010		; Enable change of output byte size and output done interrupt channel


; Coni bits . . .

test←←100000		; Enter test mode (does anal-cranial inversion)
imperr←←040000		; Imp error
idone←←020000		; Input done
iend←←010000		; Input end.
odone←←004000		; Output done
;⊗ mpln p patch NGOOD GOOD LGOOD START spw spwdsp zwait zdsp nzwait ndsp fwait fdsp bwait dsmg bdsp cpopj1 count dsm spwst owd owd1 owd2 owd4 blklup owdlup cno1 owd3 ilp inpsom inptst chklup inpc ublki LOSE

mpln←pln←←20
p←←17
array pdl[pln],mpdl[mpln],messag[300]
integer savep,cnt,savcni

patch:	block 40

NGOOD:	LGOOD			;number of words to transmit in each msg

;random data to test out the interface
GOOD:	-20
	123456,,765432
	sixbit 'NOWISTHETIMEFORALL GOODIMPINTERFACES TO START FAILING CONSISTENTLY'
	365656,,012326
	142536,,471425
	0↔1↔2↔4↔10↔20↔40↔100↔200↔400↔1000↔2000↔4000↔10000↔20000↔40000↔
	100000↔200000↔400000↔
	1B0↔1B17↔1B2↔1B15↔1B1↔1B16↔1B3↔1B14↔1B4↔1B13↔1B5↔1B12↔1B6↔1B11
	1B7↔1B9↔1B8↔1B10
	-1↔-10↔-100↔-1000↔-10000↔-100000↔-1000000↔-10000000↔-100000000↔
	-1000000000↔-10000000000↔700000000000↔400000,,0↔1↔2↔3↔4↔5↔6↔7↔10
LGOOD←←.-GOOD

START:	calli
	movei 1,spwst
	movem 1,spwdsp
	setzm nwin#
	setzm nlose#
	setom mode36#		;the compiled-in cono's use 36-bit mode
	setzm pause		;automatically retry initially
; put in initialize code here
repeat 20,<jfcl>
	move 1,[xwd 400004,spw]
	call 1,[sixbit /SPCWGO/]
	jrst main

spw:	skipn rst#
	jrst @spwdsp
	move p,[iowd pln,pdl]
	setzm rst
	setom ntest		;force typeout after first test finishes
	jrst owd

spwdsp:	0

zwait:	movei 1,zdsp
	jrst dsmg

zdsp:	move p,savep
	move 1,@(p)
	skipe (1)
	jrst dsm
	jrst cpopj1

nzwait:	movei 1,ndsp
	jrst dsmg

ndsp:	move p,savep
	move 1,@(p)
	skipn (1)
	jrst dsm
	jrst cpopj1

fwait:	movei 1,fdsp
	jrst dsmg

fdsp:	move p,savep
	coni imp,savcni
	move 1,@(p)
	conso imp,(1)
	jrst dsm
	jrst cpopj1


bwait:	movei 1,100
	movem 1,cnt
	movei 1,bdsp
dsmg:	movem 1,spwdsp
	movem p,savep
	jrst dsm

bdsp:	move p,savep
	move 1,@(p)
	conso imp,(1)
	jrst count
	aos (p)
cpopj1:	aos (p)
	popj p,

count:	sosle cnt
dsm:	call [sixbit /DISMIS/]
	coni imp,savcni
	aos (p)
	move 1,@(p)
	sos (1)
spwst:	move p,[iowd pln,pdl]

	setzm blkip#
owd:	cono imp,TEST!strout!strin!clrst!clrwt!idpien!iepien!odpien
	cono imp,TEST!clrst!clrwt
	aos ntimes#
	setzm now#
	setzm messag
	move 1,[messag,,messag+1]
	blt 1,messag+300-1	;clear input buffer in case get short msg
repeat 0,<
	datao imp,[13B15]
owd1:	pushj p,fwait
	odone!idone!iend

	consz imp,idone!iend
	pushj p,inpsom
	conso imp,odone
	jrst owd1

	datao imp,N1
owd2:	pushj p,fwait
	odone!idone!iend

	consz imp,idone!iend
	pushj p,inpsom
	conso imp,odone
	jrst owd2

	datao imp,N2
owd4:	pushj p,fwait
	odone!idone!iend

	consz imp,idone!iend
	pushj p,inpsom
	conso imp,odone
	jrst owd4
>;repeat 0

	movn 1,NGOOD
	movsi 1,(1)
	hrri 1,GOOD-1		;blko ptr for output message
	movem 1,blkop#

blklup:	blko imp,blkop
	 jfcl
owdlup:	pushj p,fwait
	odone!idone!iend

	consz imp,idone!iend
	pushj p,inpsom
	conso imp,odone
	jrst owdlup
	skipge blkop		;skip if finished sending msg
	jrst blklup		;send more data

cno1:	cono imp,TEST!fino
owd3:	pushj p,fwait
	odone!idone!iend

	consz imp,idone!iend
	pushj p,inpsom
	conso imp,odone
	jrst owd3

ilp:	skipe now		;set this from DDT to make SPW startover
	jrst owd
	pushj p,fwait
	idone!iend

	pushj p,inpsom
	jrst ilp

inpsom:	aos ninps#
	coni imp,1
	skipge blkip
	jrst ublki
;;	datai imp,leader#
	move 2,[iowd 300,messag]
	movem 2,blkip
	jrst ublki
inptst:	trnn 1,iend
	popj p,
	setzm blkip

	movn 1,NGOOD
	movsi 1,(1)

chklup:	move 2,good(1)		;get good word
	SKIPN MODE36#
	ANDCMI 2,17		;32-bit mode -- ignore low order 4 bits
	came 2,messag(1)	;check for match
	pushj p,lose		;failed
	aobjn 1,chklup

repeat 0,<
	MOVE 1,N1
	SKIPN MODE36#
	ANDCMI 1,17		;32-bit mode -- ignore low order 4 bits
	CAME 1,MESSAG
	PUSHJ P,LOSE
	MOVE 1,N2
	SKIPN MODE36#
	ANDCMI 1,17
	CAME 1,MESSAG+1
	PUSHJ P,LOSE
>;repeat 0
inpc:	cono imp,TEST!strin!clrst!clrwt!idpien!iepien
	cono imp,TEST!clrst!clrwt
	aos 3,ntest#
trn 3,;	trnn 3,77
	outchr ["."]		;print a dot every so many tests
	skipn pause#
	setom now		;start over
	popj p,

ublki:	blki imp,blkip
	jfcl
	jrst inptst

LOSE:	outchr ["↓"]		;indicate lossage
	aos nlose#
	setom pause
	popj p,
;⊗ illans rdlf main tml tlp setst notst notch outs outl seti36 seti32 noich ons onl seto36 seto32 nooch

illans:	pushj p,rdlf
	outstr [asciz /Illegal reply
/]
	outstr [typmes:	asciz /Type "Y" for "Yes", "N" for "No",
and <CR> for "no change"
/]
	popj p,

rdlf:	inchwl 1
	caie 1,12
	jrst rdlf
	popj p,


main:	move p,[iowd mpln,mpdl]
	outstr typmes
	movei 1,[asciz /IN test mode
/]
	move 2,owd
	trnn 2,test
	movei 1,[asciz /NOT in test mode
/]
	outstr (1)
repeat 0,<
tml:	outstr [asciz /Test mode?	/]
tlp:	inchwl 1
	cain 1,15
	jrst tlp
	caie 1,"y"
	cain 1,"Y"
	jrst setst
	caie 1,"n"
	cain 1,"N"
	jrst notst
	cain 1,12
	jrst notch
	pushj p,illans
	jrst tml

setst:	pushj p,rdlf
	movei 1,test
	orm 1,owd
	orm 1,cno1
	orm 1,inpc
	setom rst#
	jrst notch

notst:	pushj p,rdlf
	movei 1,test
	andcam 1,owd
	andcam 1,cno1
	andcam 1,inpc
	setom rst
>;repeat 0
notch:	movei 1,[asciz /MODE is 36-bit
/]
	move 2,owd
	trne 2,i32
	movei 1,[asciz /MODE is 32-bit
/]
	outstr (1)
outs:	outstr [asciz /MODE 36-bit?	/]
outl:	inchwl 1
	cain 1,15
	jrst outl
	caie 1,"y"
	cain 1,"Y"
	jrst seti36
	caie 1,"n"
	cain 1,"N"
	jrst seti32
	cain 1,12
	jrst noich
	pushj p,illans
	jrst outs

seti36:	pushj p,rdlf
	movei 1,i32!o32
	andcam 1,owd
	andcam 1,inpc
	setom MODE36
	setom rst
	jrst noich

seti32:	pushj p,rdlf
	movei 1,i32!o32
	orm 1,owd
	orm 1,inpc
	setzm MODE36
	setom rst
noich:	movei 1,[asciz /OMODE is 36-bit
/]
	move 2,owd
	trne 2,o32
	movei 1,[asciz /OMODE is 32-bit
/]
	outstr (1)
repeat 0,<
ons:	outstr [asciz /OMODE 36-bit?	/]
onl:	inchwl 1
	cain 1,15
	jrst onl
	caie 1,"y"
	cain 1,"Y"
	jrst seto36
	caie 1,"n"
	cain 1,"N"
	jrst seto32
	cain 1,12
	jrst nooch
	pushj p,illans
	jrst ons

seto36:	pushj p,rdlf
	movei 1,o32
	andcam 1,owd
	setom rst
	jrst nooch

seto32:	pushj p,rdlf
	movei 1,o32
	orm 1,owd
	setom rst
>;repeat 0
nooch:	jrst main

end start